@import "./colors.less";

.cm-menu {
  outline: none;
  margin-bottom: 0;
  padding-left: 0;
  list-style: none;
  z-index: 1050;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
  line-height: 42px;
}

.cm-menu,
.cm-menu-sub,
.cm-menu-item-group-list{
  list-style: none;
}

.cm-menu-sub{
  &.cm-menu{
    -webkit-box-shadow: none;
    -moz-box-shadow: none;
    box-shadow: none;
  }
}

.cm-menu-submenu{
  position: relative;
  .cm-menu-sub{
    display: none;
  }
  &.cm-menu-submenu-active{
    >.cm-menu-submenu-title:after{
      -webkit-transform: rotate(180deg) scale(0.7);
      -moz-transform: rotate(180deg) scale(0.7);
      -ms-transform: rotate(180deg) scale(0.7);
      -o-transform: rotate(180deg) scale(0.7);
      transform: rotate(180deg) scale(0.7);
    }
  }
}

.cm-menu-item{
  cursor: pointer;
  -webkit-transition: all .3s ease;
  transition: all .3s ease;
  padding: 0 16px 0 28px;
  white-space: nowrap;
  
  a {
    display: inline-block;
    width: 100%;
    height: 100%;
    transition: all 0.3s linear;
  }
  .fa{
    margin-right: 8px;
  }
  a:hover{
    color: @color-blue;
  }
  &.cm-menu-item-active{
    background: lighten(@color-blue-light, 25%);
  }
  &.cm-menu-disabled{
    a{
      color: @color-silver;
    }
  }
}

.cm-menu-item-divider{
  height: 1px;
  overflow: hidden;
  border-bottom: 1px solid #ddd;
  background-color: #aaa;
  line-height: 0;
  margin: 5px 10px;
}

.cm-menu-submenu-active>.cm-menu-submenu-title,
.cm-menu-submenu-title-hover,
.cm-menu-item.cm-menu-item-active a{
  color: @color-blue;
}
.cm-menu-item-group-title{
  cursor: default;
  padding-left: 16px;
  color: #9797AF;
}
.cm-menu-submenu-title{
  position: relative;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  white-space: nowrap;
  transition: all 0.3s linear;

  .fa{
    margin-right: 8px;
  }
  &:after{
    display: inline;
    position: absolute;
    right: 10px;
    top: 14px;
    width: 10px;
    vertical-align: baseline;
    content: "\f107";
    text-align: center;
    font: normal normal normal 14px/1 FontAwesome;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-transition: -webkit-transform .3s ease;
    transition: -webkit-transform .3s ease;
    transition: transform .3s ease;
    transition: transform .3s ease, -webkit-transform .3s ease;
    -webkit-transform: scale(0.8);
    -moz-transform: scale(0.8);
    -ms-transform: scale(0.8);
    -o-transform: scale(0.8);
    transform: scale(0.8);
  }
}


.cm-menu-inline{
  .cm-menu-item-group-title{
    padding-left: 32px;
  }
}


.cm-menu-submenu-title{
  &.cm-menu-submenu-selected{
    color: @color-blue;
  }
}

.cm-menu-vertical{
  .cm-menu-item{
    padding: 0 16px;
  }
  .cm-menu-submenu>.cm-menu-submenu-title{
    padding-left: 16px;
    &:after{
      -webkit-transform: rotate(-90deg) scale(0.7);
      -moz-transform: rotate(-90deg) scale(0.7);
      -ms-transform: rotate(-90deg) scale(0.7);
      -o-transform: rotate(-90deg) scale(0.7);
      transform: rotate(-90deg) scale(0.7);
    }
  }
  .cm-menu-sub{
    display: block;
    background: @color-white;
    box-shadow: 3px 1px 15px rgba(0,0,0,.3);
    position: absolute;
    min-width: 160px;
    left: 100%;
    top: 0;
    margin-left: -1px;
    border-radius: 3px;
    opacity: 0.1;
    transform-origin: 0 0;
    
    -webkit-transform: scale(0, 0);
    -moz-transform: scale(0, 0);
    -ms-transform: scale(0, 0);
    -o-transform: scale(0, 0);
    transform: scale(0, 0);
    -webkit-transition: transform 0.2s,opacity 0.7s;
    -moz-transition: transform 0.2s;
    -ms-transition: transform 0.2s;
    -o-transition: transform 0.2s;
    transition: transform 0.2s,opacity 0.7s;
    
    .cm-menu-submenu-title{
      padding: 0 26px 0 16px;
    }
    .cm-menu-item{
      padding: 0 16px;
    }
    .cm-menu-item-group{
      .cm-menu-item{
        padding: 0 16px 0 32px;
      }
    }
  }
  .cm-menu-item-active{
    border-right: 0;
  }
  .cm-menu-submenu-active{
    >.cm-menu-sub{
      opacity: 1;
      -webkit-transform: scale(1, 1);
      -moz-transform: scale(1, 1);
      -ms-transform: scale(1, 1);
      -o-transform: scale(1, 1);
      transform: scale(1, 1);
    }
  }
}

.light.cm-menu{
  color: #222;
  background: #fff;
}

.dark{
  &.cm-menu {
    color: rgba(255, 255, 255, 0.65);
    background: @color-dark;
  }
  .cm-menu-sub{
    background: @color-dark;
  }
  .cm-menu-item{
    a{
      color: rgba(255, 255, 255, 0.65);
      &:hover{
        color: @color-white;
      }
    }
    &.cm-menu-item-active{
      background: @color-blue;
      border-right: none;
    }
  }

  .cm-menu-submenu-active>.cm-menu-submenu-title,
  .cm-menu-submenu-title-hover,
  .cm-menu-item.cm-menu-item-active a{
    color: @color-white;
  }
  .cm-menu-item-divider{
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    background-color: #555;
  }
}

.cm-menu.cm-menu-horizontal{
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  box-shadow: none;
  border-bottom: 1px solid #efefef;
  &:after{
    content: " ";
    display: block;
    height: 0;
    clear: both;
  }
  .cm-menu-submenu{
    .cm-menu-item{
      padding: 0 16px;
    }
    .cm-menu-item-group{
      .cm-menu-item{
        padding: 0 16px 0 32px;
      }
    }
  }
  .cm-menu-submenu-title{
    padding: 0 32px 0 16px;
    &:after{
      -webkit-transform: rotate(-90deg) scale(0.7);
      -moz-transform: rotate(-90deg) scale(0.7);
      -ms-transform: rotate(-90deg) scale(0.7);
      -o-transform: rotate(-90deg) scale(0.7);
      transform: rotate(-90deg) scale(0.7);
    }
    &.cm-menu-disabled{
      color: @color-silver;
    }
  }
  >.cm-menu-item.cm-menu-item-active{
    background: transparent;
    border-right: 0;
    border-bottom: 2px solid @color-blue;
  }
  >.cm-menu-item,
  >.cm-menu-submenu{
    float: left;
    position: relative;
    display: block;
    border-bottom: 2px solid transparent;
    &.cm-menu-submenu-active{
      border-bottom: 2px solid @color-blue;
    }

    >.cm-menu-submenu-title{
      padding: 0 16px;
      &:after{
        display: none;
      }
    }
  }

  .cm-menu,
  >.cm-menu-submenu>.cm-menu{
    top: 0;
    left: 100%;
    position: absolute;
    min-width: 100%;
    margin-top: 2px;
    z-index: 1050;
    display: block;
    opacity: 0;
    background: @color-white;

    transform-origin: center 0;
  
    -webkit-transform: scale(1, 0);
    -moz-transform: scale(1, 0);
    -ms-transform: scale(1, 0);
    -o-transform: scale(1, 0);
    transform: scale(1, 0);
    -webkit-transition: transform 0.2s,opacity 0.7s;
    -moz-transition: transform 0.2s;
    -ms-transition: transform 0.2s;
    -o-transition: transform 0.2s;
    transition: transform 0.2s,opacity 0.7s;
  }
  >.cm-menu-submenu>.cm-menu{
    top: 100%;
    left: 0;
  }
  
  .cm-menu-submenu-active{
    &>.cm-menu{
      opacity: 1;
      -webkit-transform: scale(1, 1);
      -moz-transform: scale(1, 1);
      -ms-transform: scale(1, 1);
      -o-transform: scale(1, 1);
      transform: scale(1, 1);
    }
  }

  &.dark{
    border-bottom: 1px solid #333;
    .cm-menu-submenu{
      &>.cm-menu{
        background: #414956;
      }
    }
  }
}

.cm-menu-horizontal{
  .cm-menu-submenu{
    .cm-menu-sub{
      box-shadow: 0 1px 6px rgba(0,0,0,.2);
    }
  }
}
